
<%@ page import="activity.*" %>
<!DOCTYPE html>
<html>
	<head>
                <meta name="layout" content="backend">
		<g:set var="entityName" value="${message(code: 'register.label', default: 'Register')}" />
		<title><g:message code="default.list.label" args="[entityName]" /></title>
	</head>
	<body>
		<a href="#list-register" class="skip" tabindex="-1"><g:message code="default.link.skip.label" default="Skip to content&hellip;"/></a>
		<div class="gnav" role="navigation">
			<ul>
				<!--<li><g:link class="create" action="create"><g:message code="default.new.label" args="[entityName]" /></g:link></li>-->
			</ul>
		</div>
		<div id="list-register" class="content scaffold-list" role="main">
                        <h1><g:message code="default.list.label" args="[entityName]" /></h1>
                        <h4>
                            <g:message code="register.serial.label" default="Serial" />：${fieldValue(bean: registerInstanceList[0], field: "serial")}</br>
                            <g:message code="register.event.label" default="Event" />：${fieldValue(bean: registerInstanceList[0], field: "event")}</br>
                            <g:if test="${registerInstanceList[0]}">
                                <g:set var="event" value="${registerInstanceList[0].event}"/>
                                已報/可報/候補名額：${event.registerQty}/${event.capacityQty}/${event.standbyQty}</br>
                            </g:if>
                        </h4>
                        <g:if test="${params.eventId}">
                            <g:set var="eventId" value="${params.eventId}" scope="session" />
                        </g:if>
                        <g:form action="search">
                            <g:select name="field" from="${['系統碼','身分證號','姓名','報名狀態','出席狀態']}" />
                            <g:textField name="txt"/>
                            <g:submitButton name="search" value="搜尋" class="btn btn-primary" />
                        </g:form>
			<g:if test="${flash.message}">
			<div class="message" role="status">${flash.message}</div>
			</g:if>
                        <g:if test="${registerInstanceTotal > 0}">
                            ｜<g:link controller="register" action="list" params="[eventId:"${params.eventId}", format:'excel', extension:'xls']">輸出EXCEL</g:link>｜
                        </g:if>
			<table>
				<thead>
					<tr>
					
                                            <th>序號</th>
                                            
                                            <th><g:message code="register.sysCode" default="系統碼" /></th>
                                            
                                            <th><g:message code="register.reader.label" default="Reader" /></th>
                                            
                                            <!--<th><g:message code="register.serial.label" default="Serial" /></th>-->
					
						<!--<th><g:message code="register.event.label" default="Event" /></th>-->
                                                
                                                <th><g:message code="register.CID.label" default="Event" /></th>
                                                
                                                <th><g:message code="reader.birth.label" default="生日" /></th>
                                                
                                                <th><g:message code="reader.gender.label" default="性別" /></th>
                                                
                                                <th><g:message code="reader.tel1.label" default="電話" /></th>

                                                <!--<th><g:message code="register.regTime.label" default="Event" /></th>-->
                                                
                                                <th><g:message code="register.status.label" default="Event" /></th>
					
                                                <!--<th><g:message code="register.present.label" default="Event" /></th>-->
                                                
                                                <th>補到/審過</th>
                                                
                                                <!--<th>報到/簽退</th>-->
					
					</tr>
				</thead>
				<tbody>
				<g:each in="${registerInstanceList}" status="i" var="registerInstance">
					<tr class="${(i % 2) == 0 ? 'even' : 'odd'}">
					
                                            <td><g:link action="show" id="${registerInstance.id}">${i+1}</g:link></td>
                                            
                                            <td>${fieldValue(bean: registerInstance, field: "sysCode")}</td>
                                            
                                            <!--<td><g:link controller="reader" action="show" id="${registerInstance.reader.id}">${fieldValue(bean: registerInstance.reader, field: "name")}</g:link></td>-->
                                            <td>${fieldValue(bean: registerInstance.reader, field: "name")}</td>
                                            
                                            <!--<td>${fieldValue(bean: registerInstance, field: "serial")}</td>-->
					
						<!--<td>${fieldValue(bean: registerInstance, field: "event")}</td>-->
					
						<td>${fieldValue(bean: registerInstance, field: "CID")}</td>
                                                
                                                <td><g:formatDate format="yyyy-MM-dd" date="${registerInstance.reader.birth}"/></td>
                                                
                                                <td>${fieldValue(bean: registerInstance.reader, field: "gender")}</td>
                                                
                                                <td>${fieldValue(bean: registerInstance.reader, field: "tel1")}</td>

<!--                                                <td>${fieldValue(bean: registerInstance, field: "regTime")}</td>-->

                                                <td>${fieldValue(bean: registerInstance, field: "status")}</td>
                                                
                                                <!--<td>${fieldValue(bean: registerInstance, field: "present")}</td>-->

                                                <td>
                                                <g:if test="${registerInstance.status == '候補報名'}">
                                                    <g:link action="changeStandby" id="${registerInstance.id}">補到</g:link>
                                                </g:if>        
                                                <g:elseif test="${registerInstance.status == '待審報名'}">
                                                    <g:link action="changeAudit" id="${registerInstance.id}">審過</g:link>/<g:link action="rejectAudit" id="${registerInstance.id}">審拒</g:link>
                                                </g:elseif>
                                                <g:else>　</g:else>
                                                </td>

<!--                                                <td>
                                                    <g:if test="${registerInstance.present == '未出席'}">
                                                        <g:link action="changePresent" id="${registerInstance.id}">報到</g:link>
                                                    </g:if>        
                                                    <g:elseif test="${registerInstance.present == '已出席'}">
                                                        <g:link action="changeLeave" id="${registerInstance.id}">簽退</g:link>
                                                    </g:elseif>
                                                    <g:else>　</g:else>
                                                 </td>-->

                                        </tr>
				</g:each>
				</tbody>
			</table>
			<!--<div class="pagination">-->
				<!--<m:paginate total="${registerInstanceTotal}" />-->
			<!--</div>-->
		</div>
	</body>
</html>
